<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/24 0024
 * Time: 下午 2:26
 */
namespace app\common\model;

use think\Model;

class User extends Model{
    protected $autoWriteTimestamp = true;

    public function address(){
        return $this->hasMany('Useraddress','userId','id');
    }

    public static function getByOpenID($openid){
        $user = self::where('openid','=',$openid)->find();
        return $user;
    }


    /**
     * @param $userId
     * @return array|false|\PDOStatement|string|Model
     */
    public function findCurrentUser($userId){
        return self::where('id','=',$userId)->find();
    }



}